using System;
using System.Collections.Generic;
using System.Text;

using NHibernate;
using Zwms.Data.BusinessObjects;
using Zwms.Data.Base;
using Zwms.Data.CommonObject;
using NHibernate.Criterion;
using System.Reflection;

namespace Zwms.Data.ManagerObjects
{
    public partial interface ISysLoginInfManager : IManagerBase<Zwms.Data.BusinessObjects.SysLoginInf, string>
    {
        // Get Methods
        SysLoginInf GetById(System.String userCode, System.String sysDate, System.String logTime, System.String logSgn);
    }

    partial class SysLoginInfManager : ManagerBase<Zwms.Data.BusinessObjects.SysLoginInf, string>, ISysLoginInfManager
    {
        #region Constructors

        public SysLoginInfManager()
            : base()
        {
        }
        public SysLoginInfManager(INHibernateSession session)
            : base(session)
        {
        }

        #endregion

        #region Get Methods

        public override SysLoginInf GetById(string id)
        {
            string[] keys = id.Split('^');

            if (keys.Length != 4)
                throw new Exception("Invalid Id for SysLoginInfManager.GetById");

            return GetById(keys[0], keys[1], keys[2], keys[3]);
        }
        public SysLoginInf GetById(System.String userCode, System.String sysDate, System.String logTime, System.String logSgn)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(SysLoginInf));

            criteria.Add(NHibernate.Criterion.Expression.Eq("UserCode", userCode));
            criteria.Add(NHibernate.Criterion.Expression.Eq("SysDate", sysDate));
            criteria.Add(NHibernate.Criterion.Expression.Eq("LogTime", logTime));
            criteria.Add(NHibernate.Criterion.Expression.Eq("LogSgn", logSgn));

            SysLoginInf result = (SysLoginInf)criteria.UniqueResult();

            return result;
        }
 
        #endregion
    }
}